Fedora 22
Sponsored Link

Docker : Install
2015/06/03
 
Install Docker which is the Software Containers Tool.
[1] Install Docker.
[root@dlp ~]#
dnf -y install docker
[root@dlp ~]#
systemctl start docker

[root@dlp ~]#
systemctl enable docker

[2] Download an official image and create a Container and also output the words "Welcome to the Docker World" from the Container.
[root@dlp ~]#
docker run fedora /bin/echo "Welcome to the Docker World"

Unable to find image 'fedora' locally
Pulling repository fedora
00a0c78eeb6d: Download complete
Welcome to the Docker World
# just executed
[3] Connect to the interactive session of a Container with "i" and "t" option like follows. If exit from the Container session, the process of a Container finishs.
[root@dlp ~]#
docker run -i -t fedora /bin/bash

[root@2627e14b6f0e /]#
# just connected
[root@2627e14b6f0e /]#
uname -a

Linux 2627e14b6f0e 4.0.4-301.fc22.x86_64 #1 SMP Thu May 21 13:10:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@2627e14b6f0e /]#
exit

exit
[root@dlp ~]#
# be back
[4] If you'd like to exit from the Container session with keeping container's process, push Ctrl+p, and Ctrl+q key.
[root@dlp ~]#
docker run -i -t fedora /bin/bash

[root@25eaf056ade4 /]# [root@dlp ~]#
# Ctrl+p, Ctrl+q to be back to Host's console
[root@dlp ~]#
docker ps
# show docker process

CONTAINER ID   IMAGE          COMMAND      CREATED          STATUS         PORTS  NAMES
25eaf056ade4   fedora:latest  "/bin/bash"  44 seconds ago   Up 43 seconds         clever_payne

# connect to container's session

[root@dlp ~]#
docker attach 25eaf056ade4

[root@25eaf056ade4 /]#
# connected
# shutdown container's process from Host's console

[root@dlp ~]#
docker kill 25eaf056ade4

[root@dlp ~]#
docker ps

CONTAINER ID    IMAGE          COMMAND       CREATED          STATUS          PORTS     NAMES
 
Tweet